﻿<%@ Page Title="" Language="C#" MasterPageFile="~/_console/_console.Master" AutoEventWireup="true"
    CodeBehind="role-add.aspx.cs" Inherits="SmartSpace.WebApp._console.core.role_add" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderHead" runat="server">
    <script type="text/javascript">
        function checkSpecialStr(str) {
            var bl = true;
            var arr = new Array("@", "#", "$", "%", "&", "|", "\\", "//");
            i = arr.length;
            j = str.length;
            str = $.trim(str);
            if (str == "") {
                bl = true;
            } else {
                for (ii = 0; ii < i; ii++) {
                    for (jj = 0; jj < j; jj++) {
                        temp1 = str.charAt(jj);
                        temp2 = arr[ii];
                        if (temp1 == temp2) {
                            bl = false;
                        }
                    }
                }
            }
            return bl;
        }

        function checkSubmit() {
            var msg = "";
            var str_Name = $("#_ctlEditName").val();
            var str_Caption = $("#_ctlEditCaption").val();
            if ($.trim(str_Name).length == 0) {
                msg = "Name is not allow null!";
            }
            if ($.trim(str_Caption).length == 0) {
                msg = "Caption is not allow null!";
            }
            if ($.trim(str_Caption).length != 0 && !checkSpecialStr(str_Caption)) {
                msg = "名称不允许为非法字符!";
            }
            if ($.trim(str_Name).length != 0 && !checkSpecialStr(str_Name)) {
                msg = "Name不允许为非法字符!";
            }
            if (msg == "") {
                if (window.confirm("Are you sure to add this information?")) {
                    return true;
                }
                else {
                    return false;
                }
            }
            else {
                alert(msg);
                return false;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderMenu" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderTitle" runat="server">
    添加角色
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolderToolbar" runat="server">
    <asp:HyperLink ID="_ctlLinkBack" runat="server" NavigateUrl="~/_console/core/role-list.aspx">返回</asp:HyperLink>
    <asp:LinkButton ID="_ctlBtnSave" runat="server" Text="保存" OnClick="_ctlBtnSave_Click" OnClientClick="return checkSubmit();" />
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="ContentPlaceHolderContent" runat="server">
    <div class="form">
        <label>
            Name</label><br />
        <asp:TextBox ID="_ctlEditName" ClientIDMode="Static" runat="server" Width="400"></asp:TextBox><br />
        <label>
            名称</label><br />
        <asp:TextBox ID="_ctlEditCaption" ClientIDMode="Static" runat="server" Width="400"></asp:TextBox>
    </div>
</asp:Content>
